<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.15"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>wickr-crypto-c: src/wickrcrypto/include/wickrcrypto/ecdh_cipher_ctx.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">wickr-crypto-c
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.15 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_92a70b6cc7e213c660915fdf1190028f.html">wickrcrypto</a></li><li class="navelem"><a class="el" href="dir_db4377ef08cfba82f5e7141624102360.html">include</a></li><li class="navelem"><a class="el" href="dir_2adb4122f2f58e588d09641dee9865e2.html">wickrcrypto</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">ecdh_cipher_ctx.h</div>  </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="comment">/*</span></div><div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="comment"> * Copyright © 2012-2018 Wickr Inc.  All rights reserved.</span></div><div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="comment"> *</span></div><div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="comment"> * This code is being released for EDUCATIONAL, ACADEMIC, AND CODE REVIEW PURPOSES</span></div><div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="comment"> * ONLY.  COMMERCIAL USE OF THE CODE IS EXPRESSLY PROHIBITED.  For additional details,</span></div><div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="comment"> * please see LICENSE</span></div><div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="comment"> *</span></div><div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="comment"> * THE CODE IS MADE AVAILABLE &quot;AS-IS&quot; AND WITHOUT ANY EXPRESS OR</span></div><div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="comment"> * IMPLIED GUARANTEES AS TO FITNESS, MERCHANTABILITY, NON-</span></div><div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="comment"> * INFRINGEMENT OR OTHERWISE. IT IS NOT BEING PROVIDED IN TRADE BUT ON</span></div><div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="comment"> * A VOLUNTARY BASIS ON BEHALF OF THE AUTHOR’S PART FOR THE BENEFIT</span></div><div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="comment"> * OF THE LICENSEE AND IS NOT MADE AVAILABLE FOR CONSUMER USE OR ANY</span></div><div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="comment"> * OTHER USE OUTSIDE THE TERMS OF THIS LICENSE. ANYONE ACCESSING THE</span></div><div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="comment"> * CODE SHOULD HAVE THE REQUISITE EXPERTISE TO SECURE THEIR SYSTEM</span></div><div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="comment"> * AND DEVICES AND TO ACCESS AND USE THE CODE FOR REVIEW PURPOSES</span></div><div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;<span class="comment"> * ONLY. LICENSEE BEARS THE RISK OF ACCESSING AND USING THE CODE. IN</span></div><div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;<span class="comment"> * PARTICULAR, AUTHOR BEARS NO LIABILITY FOR ANY INTERFERENCE WITH OR</span></div><div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;<span class="comment"> * ADVERSE EFFECT THAT MAY OCCUR AS A RESULT OF THE LICENSEE</span></div><div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="comment"> * ACCESSING AND/OR USING THE CODE ON LICENSEE’S SYSTEM.</span></div><div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;<span class="comment"> */</span></div><div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;</div><div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;<span class="preprocessor">#ifndef ecdh_cipher_ctx_h</span></div><div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;<span class="preprocessor">#define ecdh_cipher_ctx_h</span></div><div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;</div><div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;<span class="preprocessor">#include &quot;crypto_engine.h&quot;</span></div><div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;</div><div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;<span class="preprocessor">#ifdef __cplusplus</span></div><div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;<span class="keyword">extern</span> <span class="stringliteral">&quot;C&quot;</span> {</div><div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;<span class="preprocessor">#endif</span></div><div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;    </div><div class="line"><a name="l00047"></a><span class="lineno"><a class="line" href="structwickr__ecdh__cipher__ctx.html">   47</a></span>&#160;<span class="keyword">struct </span><a class="code" href="structwickr__ecdh__cipher__ctx.html">wickr_ecdh_cipher_ctx</a> {</div><div class="line"><a name="l00048"></a><span class="lineno"><a class="line" href="structwickr__ecdh__cipher__ctx.html#a4d953a0c8d6302db63f2fce624e6ffc2">   48</a></span>&#160;    <a class="code" href="structwickr__crypto__engine.html">wickr_crypto_engine_t</a> <a class="code" href="structwickr__ecdh__cipher__ctx.html#a4d953a0c8d6302db63f2fce624e6ffc2">engine</a>;</div><div class="line"><a name="l00049"></a><span class="lineno"><a class="line" href="structwickr__ecdh__cipher__ctx.html#ad9389a9efc31ac0516d9aebeb1ac6301">   49</a></span>&#160;    <a class="code" href="structwickr__ec__key.html">wickr_ec_key_t</a> *<a class="code" href="structwickr__ecdh__cipher__ctx.html#ad9389a9efc31ac0516d9aebeb1ac6301">local_key</a>;</div><div class="line"><a name="l00050"></a><span class="lineno"><a class="line" href="structwickr__ecdh__cipher__ctx.html#a15e7d01b0e07501b572c11bde1c2e56e">   50</a></span>&#160;    <a class="code" href="structwickr__cipher.html">wickr_cipher_t</a> <a class="code" href="structwickr__ecdh__cipher__ctx.html#a15e7d01b0e07501b572c11bde1c2e56e">cipher</a>;</div><div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;};</div><div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;</div><div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;<span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="structwickr__ecdh__cipher__ctx.html">wickr_ecdh_cipher_ctx</a> <a class="code" href="structwickr__ecdh__cipher__ctx.html">wickr_ecdh_cipher_ctx_t</a>;</div><div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;</div><div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;<a class="code" href="structwickr__ecdh__cipher__ctx.html">wickr_ecdh_cipher_ctx_t</a> *wickr_ecdh_cipher_ctx_create(<a class="code" href="structwickr__crypto__engine.html">wickr_crypto_engine_t</a> <a class="code" href="structwickr__ecdh__cipher__ctx.html#a4d953a0c8d6302db63f2fce624e6ffc2">engine</a>,</div><div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;                                                      <a class="code" href="structwickr__ec__curve.html">wickr_ec_curve_t</a> curve,</div><div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;                                                      <a class="code" href="structwickr__cipher.html">wickr_cipher_t</a> <a class="code" href="structwickr__ecdh__cipher__ctx.html#a15e7d01b0e07501b572c11bde1c2e56e">cipher</a>);</div><div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;</div><div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;<a class="code" href="structwickr__ecdh__cipher__ctx.html">wickr_ecdh_cipher_ctx_t</a> *wickr_ecdh_cipher_ctx_create_key(<a class="code" href="structwickr__crypto__engine.html">wickr_crypto_engine_t</a> <a class="code" href="structwickr__ecdh__cipher__ctx.html#a4d953a0c8d6302db63f2fce624e6ffc2">engine</a>,</div><div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;                                                          <a class="code" href="structwickr__ec__key.html">wickr_ec_key_t</a> *key,</div><div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;                                                          <a class="code" href="structwickr__cipher.html">wickr_cipher_t</a> <a class="code" href="structwickr__ecdh__cipher__ctx.html#a15e7d01b0e07501b572c11bde1c2e56e">cipher</a>);</div><div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;</div><div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;<a class="code" href="structwickr__ecdh__cipher__ctx.html">wickr_ecdh_cipher_ctx_t</a> *wickr_ecdh_cipher_ctx_copy(<span class="keyword">const</span> <a class="code" href="structwickr__ecdh__cipher__ctx.html">wickr_ecdh_cipher_ctx_t</a> *ctx);</div><div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;</div><div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;<span class="keywordtype">void</span> wickr_ecdh_cipher_ctx_destroy(<a class="code" href="structwickr__ecdh__cipher__ctx.html">wickr_ecdh_cipher_ctx_t</a> **ctx);</div><div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;</div><div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;<a class="code" href="structwickr__cipher__result.html">wickr_cipher_result_t</a> *wickr_ecdh_cipher_ctx_cipher(<span class="keyword">const</span> <a class="code" href="structwickr__ecdh__cipher__ctx.html">wickr_ecdh_cipher_ctx_t</a> *ctx,</div><div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160;                                                    <span class="keyword">const</span> <a class="code" href="structwickr__buffer.html">wickr_buffer_t</a> *plaintext,</div><div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;                                                    <span class="keyword">const</span> <a class="code" href="structwickr__ec__key.html">wickr_ec_key_t</a> *remote_pub,</div><div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160;                                                    <span class="keyword">const</span> <a class="code" href="structwickr__kdf__meta.html">wickr_kdf_meta_t</a> *kdf_params);</div><div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;</div><div class="line"><a name="l00127"></a><span class="lineno">  127</span>&#160;<a class="code" href="structwickr__buffer.html">wickr_buffer_t</a> *wickr_ecdh_cipher_ctx_decipher(<span class="keyword">const</span> <a class="code" href="structwickr__ecdh__cipher__ctx.html">wickr_ecdh_cipher_ctx_t</a> *ctx,</div><div class="line"><a name="l00128"></a><span class="lineno">  128</span>&#160;                                               <span class="keyword">const</span> <a class="code" href="structwickr__cipher__result.html">wickr_cipher_result_t</a> *ciphertext,</div><div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160;                                               <span class="keyword">const</span> <a class="code" href="structwickr__ec__key.html">wickr_ec_key_t</a> *remote_pub,</div><div class="line"><a name="l00130"></a><span class="lineno">  130</span>&#160;                                               <span class="keyword">const</span> <a class="code" href="structwickr__kdf__meta.html">wickr_kdf_meta_t</a> *kdf_params);</div><div class="line"><a name="l00131"></a><span class="lineno">  131</span>&#160;    </div><div class="line"><a name="l00132"></a><span class="lineno">  132</span>&#160;    </div><div class="line"><a name="l00133"></a><span class="lineno">  133</span>&#160;    </div><div class="line"><a name="l00134"></a><span class="lineno">  134</span>&#160;<span class="preprocessor">#ifdef __cplusplus</span></div><div class="line"><a name="l00135"></a><span class="lineno">  135</span>&#160;}</div><div class="line"><a name="l00136"></a><span class="lineno">  136</span>&#160;<span class="preprocessor">#endif</span></div><div class="line"><a name="l00137"></a><span class="lineno">  137</span>&#160;</div><div class="line"><a name="l00138"></a><span class="lineno">  138</span>&#160;<span class="preprocessor">#endif </span><span class="comment">/* ecdh_cipher_ctx_h */</span><span class="preprocessor"></span></div><div class="ttc" id="structwickr__ecdh__cipher__ctx_html"><div class="ttname"><a href="structwickr__ecdh__cipher__ctx.html">wickr_ecdh_cipher_ctx</a></div><div class="ttdoc">A cipher context designed to modularize the ECDH_HKDF_AES256 workflow.</div><div class="ttdef"><b>Definition:</b> ecdh_cipher_ctx.h:47</div></div>
<div class="ttc" id="structwickr__kdf__meta_html"><div class="ttname"><a href="structwickr__kdf__meta.html">wickr_kdf_meta</a></div><div class="ttdoc">Represents the information the KDF function will need along with it's input to derive a particular ou...</div><div class="ttdef"><b>Definition:</b> kdf.h:135</div></div>
<div class="ttc" id="structwickr__ec__key_html"><div class="ttname"><a href="structwickr__ec__key.html">wickr_ec_key</a></div><div class="ttdoc">Representation of public and private Elliptic Curve Keypair information as buffers.</div><div class="ttdef"><b>Definition:</b> eckey.h:90</div></div>
<div class="ttc" id="structwickr__ecdh__cipher__ctx_html_a4d953a0c8d6302db63f2fce624e6ffc2"><div class="ttname"><a href="structwickr__ecdh__cipher__ctx.html#a4d953a0c8d6302db63f2fce624e6ffc2">wickr_ecdh_cipher_ctx::engine</a></div><div class="ttdeci">wickr_crypto_engine_t engine</div><div class="ttdef"><b>Definition:</b> ecdh_cipher_ctx.h:48</div></div>
<div class="ttc" id="structwickr__buffer_html"><div class="ttname"><a href="structwickr__buffer.html">wickr_buffer</a></div><div class="ttdoc">Represents an array of bytes and the length of the allocation associated with those bytes.</div><div class="ttdef"><b>Definition:</b> buffer.h:51</div></div>
<div class="ttc" id="structwickr__cipher_html"><div class="ttname"><a href="structwickr__cipher.html">wickr_cipher</a></div><div class="ttdoc">Represents a cipher that can be used in the crypto_engine. This meta object holds parameters for the ...</div><div class="ttdef"><b>Definition:</b> cipher.h:56</div></div>
<div class="ttc" id="structwickr__cipher__result_html"><div class="ttname"><a href="structwickr__cipher__result.html">wickr_cipher_result</a></div><div class="ttdef"><b>Definition:</b> cipher.h:97</div></div>
<div class="ttc" id="structwickr__ecdh__cipher__ctx_html_a15e7d01b0e07501b572c11bde1c2e56e"><div class="ttname"><a href="structwickr__ecdh__cipher__ctx.html#a15e7d01b0e07501b572c11bde1c2e56e">wickr_ecdh_cipher_ctx::cipher</a></div><div class="ttdeci">wickr_cipher_t cipher</div><div class="ttdef"><b>Definition:</b> ecdh_cipher_ctx.h:50</div></div>
<div class="ttc" id="structwickr__crypto__engine_html"><div class="ttname"><a href="structwickr__crypto__engine.html">wickr_crypto_engine</a></div><div class="ttdoc">Interface to a set of cryptographic operations used throughout the library. Currently the default imp...</div><div class="ttdef"><b>Definition:</b> crypto_engine.h:53</div></div>
<div class="ttc" id="structwickr__ec__curve_html"><div class="ttname"><a href="structwickr__ec__curve.html">wickr_ec_curve</a></div><div class="ttdoc">Metadata about curve types to help with key generation, and signatures.</div><div class="ttdef"><b>Definition:</b> eckey.h:65</div></div>
<div class="ttc" id="structwickr__ecdh__cipher__ctx_html_ad9389a9efc31ac0516d9aebeb1ac6301"><div class="ttname"><a href="structwickr__ecdh__cipher__ctx.html#ad9389a9efc31ac0516d9aebeb1ac6301">wickr_ecdh_cipher_ctx::local_key</a></div><div class="ttdeci">wickr_ec_key_t * local_key</div><div class="ttdef"><b>Definition:</b> ecdh_cipher_ctx.h:49</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.15
</small></address>
</body>
</html>
